import { lazy, Suspense } from "react";
import { BrowserRouter, useRoutes } from "react-router-dom";
const Home = lazy(() => import("../views/home"));
const Menu = lazy(() => import("../views/menu"));
const Vip = lazy(() => import("../views/vip"));
const Car = lazy(() => import("../views/car"));
const Mine = lazy(() => import("../views/mine"));
const ROUTER_LIST = [
  {
    path: "/home",
    element: <Home></Home>,
  },
  {
    path: "/menu",
    element: <Menu></Menu>,
  },
  {
    path: "/vip",
    element: <Vip></Vip>,
  },
  {
    path: "/car",
    element: <Car></Car>,
  },
  {
    path: "/mine",
    element: <Mine></Mine>,
  },
];
const routes = () => {
  const RouterView = () => useRoutes(ROUTER_LIST);
  <BrowserRouter>
    <Suspense fallback={<div>路由加载中···</div>}>
      <RouterView></RouterView>
    </Suspense>
  </BrowserRouter>;
};
